﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:uc="clr-namespace:FileExplorer.WPF.UserControls"
    xmlns:bc="clr-namespace:FileExplorer.WPF.BaseControls"
    xmlns:cali ="http://www.caliburnproject.org"
    xmlns:conv="clr-namespace:QuickZip.Converters"
    >
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Default/Colors.xaml" />
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Default/Brushes.xaml" />
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Default/Geometry.xaml" />
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Common/Buttons.xaml" />
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Common/DropDown.xaml" />
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Common/Thumb.xaml" />
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Common/RadioCombo.xaml" />

    </ResourceDictionary.MergedDictionaries>

    <SolidColorBrush x:Key="MenuItem.Highlight.Background" Color="#3D26A0DA"/>
    <SolidColorBrush x:Key="MenuItem.Highlight.Border" Color="#FF26A0DA"/>
    <SolidColorBrush x:Key="Menu.Disabled.Foreground" Color="#FF707070"/>
    <SolidColorBrush x:Key="MenuItem.Highlight.Disabled.Background" Color="#0A000000"/>
    <SolidColorBrush x:Key="MenuItem.Highlight.Disabled.Border" Color="#21000000"/>
    <SolidColorBrush x:Key="MenuItem.Selected.Border" Color="#FF26A0DA"/>
    <SolidColorBrush x:Key="MenuItem.Selected.Background" Color="#3D26A0DA"/>
    <SolidColorBrush x:Key="Menu.Static.Foreground" Color="#FF212121"/>
    <SolidColorBrush x:Key="Menu.Static.Border" Color="#FF999999"/>
    <SolidColorBrush x:Key="Menu.Static.Background" Color="#FFF0F0F0"/>
    <SolidColorBrush x:Key="Menu.Static.Separator" Color="#FFD7D7D7"/>

    <!-- Either Symbol or Icon -->
    <ControlTemplate x:Key="ToolbarMenuIconTemplate2" TargetType="{x:Type ContentControl}">
        <Grid VerticalAlignment="Center" HorizontalAlignment="Center" Width="16">
            <TextBlock FontFamily="Segoe UI Symbol"                        
                       Text="{Binding Symbol, RelativeSource={RelativeSource AncestorType={x:Type MenuItem}}}" />
            <ContentControl Content="{Binding Icon, RelativeSource={RelativeSource AncestorType={x:Type MenuItem}}}"   
                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
        </Grid>
    </ControlTemplate>

    <!-- Either Symbol or Icon or Checkmark -->
    <ControlTemplate x:Key="ToolbarMenuIconTemplate3" TargetType="{x:Type ContentControl}">
        <Grid VerticalAlignment="Center" HorizontalAlignment="Center" Width="16">
            <ContentControl Template="{StaticResource ToolbarMenuIconTemplate2}" />
            <Path x:Name="GlyphPanel" Data="{StaticResource Checkmark}" 
                          Fill="{TemplateBinding Foreground}" 
                          FlowDirection="LeftToRight" Visibility="{Binding IsChecked, 
                            RelativeSource={RelativeSource AncestorType={x:Type MenuItem}}, Converter={StaticResource btvc}}" />
        </Grid>
    </ControlTemplate>

    <ControlTemplate x:Key="ToolbarEx.ButtonTemplate" TargetType="{x:Type uc:ToolbarItemEx}">
        <Border x:Name="templateRoot" BorderBrush="{TemplateBinding BorderBrush}" 
                BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}"
                Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
            <Border.Clip>
                <MultiBinding Converter="{StaticResource bc}">
                    <Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}"/>
                    <Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}"/>
                    <Binding Path="CornerRadius" RelativeSource="{RelativeSource Self}"/>
                </MultiBinding>
            </Border.Clip>

            <bc:HotTrack IsSelected="{TemplateBinding IsHighlighted}"
                         HighlightBrush="Transparent" BackgroundBrush="Transparent" >
                <Grid VerticalAlignment="Center" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <ProgressBar     Grid.ColumnSpan="2" Foreground="{StaticResource MenuItem.Highlight.Background}"
                                     Background="Transparent" BorderThickness="0"
                                     Value="{Binding Path=SliderValue, 
                                                RelativeSource={RelativeSource FindAncestor, 
                                                AncestorType={x:Type uc:ToolbarItemEx}}, Mode=TwoWay}"
                                           Maximum="{Binding Path=SliderMaximum, 
                                                RelativeSource={RelativeSource FindAncestor, 
                                                AncestorType={x:Type uc:ToolbarItemEx}}, Mode=TwoWay}"
                                           Minimum="{Binding Path=SliderMinimum, 
                                                RelativeSource={RelativeSource FindAncestor, 
                                                AncestorType={x:Type uc:ToolbarItemEx}}, Mode=TwoWay}"  
                                                     
                                                      Visibility="{Binding Path=IsSliderEnabled, 
                                                RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type uc:ToolbarItemEx}}, 
                                                Converter={StaticResource btv}, 
                                                Mode=TwoWay}"    
                                                     />
                    <ContentControl x:Name="MenuIcon" Grid.Column="0" Template="{StaticResource ToolbarMenuIconTemplate3}" />
                    <ContentPresenter Grid.Column="1" ContentSource="Header" VerticalAlignment="Center"
                                          Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" 
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>

                    <Thumb Grid.ColumnSpan="2"
                        Template="{StaticResource BlankThumb}"
                        Visibility="{Binding Path=IsSliderEnabled, 
                                                RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type uc:ToolbarItemEx}}, 
                                                Converter={StaticResource btv}, 
                                                Mode=TwoWay}"    
                           />
                </Grid>
            </bc:HotTrack>

        </Border>
    </ControlTemplate>

    <ControlTemplate x:Key="ToolbarEx.ComboTemplate" TargetType="{x:Type uc:ToolbarItemEx}">
        <Border x:Name="templateRoot" BorderBrush="{TemplateBinding BorderBrush}" 
                BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}"
                Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
            <Border.Clip>
                <MultiBinding Converter="{StaticResource bc}">
                    <Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}"/>
                    <Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}"/>
                    <Binding Path="CornerRadius" RelativeSource="{RelativeSource Self}"/>
                </MultiBinding>
            </Border.Clip>

            <Grid VerticalAlignment="Center" Margin="3,0" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <ItemsPresenter />
            </Grid>

        </Border>
    </ControlTemplate>

    <ControlTemplate x:Key="ToolbarEx.MenuButtonTemplate" TargetType="{x:Type uc:ToolbarItemEx}">
        <Border x:Name="templateRoot" BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}"
                Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
            <Border.Clip>
                <MultiBinding Converter="{StaticResource bc}">
                    <Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}"/>
                    <Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}"/>
                    <Binding Path="CornerRadius" RelativeSource="{RelativeSource Self}"/>
                </MultiBinding>
            </Border.Clip>

            <bc:HotTrack>
                <Grid VerticalAlignment="Center"  >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <Button x:Name="HeaderButton" Template="{StaticResource BlankButton}" Grid.Column="0" Margin="6,0"
                            Command="{TemplateBinding Command}" CommandParameter="{TemplateBinding CommandParameter}" 
                            IsHitTestVisible="True">
                        <StackPanel Orientation="Horizontal">
                            <ContentControl x:Name="MenuIcon" Grid.Column="0" Template="{StaticResource ToolbarMenuIconTemplate3}"
                                    Margin="0,0,6,0" />
                            <ContentPresenter ContentSource="Header" VerticalAlignment="Center"
                                          RecognizesAccessKey="True" 
                                          Visibility="{Binding IsHeaderVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource btvc}}"
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </StackPanel>
                    </Button>

                    <bc:DropDown x:Name="ExpanderDropDown" 
                                 Visibility="{Binding HasItems, 
                                            RelativeSource={RelativeSource Mode=TemplatedParent}, 
                                            Converter={StaticResource btvc}}"
                                 BorderThickness="0"  Grid.Column="1" HeaderButtonTemplate="{StaticResource BlankButton}" 
                                 Padding="6,0" IsDropDownOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
                        <bc:DropDown.Header>
                            <bc:HotTrack x:Name="ExpanderHotTrack" IsSelected="False"
                                         SelectedBorderBrush="{TemplateBinding  InnerBorderBrush}" BorderThickness="1,0,0,0"
                                         SelectedBrush="Transparent" BackgroundBrush="Transparent" HighlightBrush="Transparent"
                                         BorderBrush="Transparent" >
                                <Path x:Name="path" Margin="{TemplateBinding Padding}"
                                    Stroke="{TemplateBinding Foreground}" 
                                    Fill="{TemplateBinding Foreground}"
                                    StrokeThickness="1.2" Data="{StaticResource ExpandedArrow}"
                                    HorizontalAlignment="Center" VerticalAlignment="Center" />
                            </bc:HotTrack>
                        </bc:DropDown.Header>
                        <bc:DropDown.Content>
                            <ScrollViewer x:Name="SubMenuScrollViewer" 
                                      Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, 
                                        TypeInTargetAssembly={x:Type FrameworkElement}}}">
                                <Grid x:Name="baseGrid" RenderOptions.ClearTypeHint="Enabled">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <!-- Slider -->
                                        <ColumnDefinition MinWidth="22" SharedSizeGroup="MenuItemIconColumnGroup" Width="Auto"/>
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>

                                    <Canvas HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0" Grid.ColumnSpan="2">
                                        <Rectangle x:Name="OpaqueRect" Fill="{Binding Background, ElementName=baseGrid}" 
                                               Height="{Binding ActualHeight, ElementName=baseGrid}"
                                               Width="{Binding ActualWidth, ElementName=baseGrid}"/>
                                    </Canvas>

                                    <Rectangle Fill="{StaticResource Menu.Static.Separator}" HorizontalAlignment="Left" 
                                               Margin="29,2,0,2" Width="1" Grid.Column="1"/>

                                    <ItemsPresenter x:Name="ItemsPresenter" Grid.ColumnSpan="2" Grid.Column="1" 
                                                KeyboardNavigation.DirectionalNavigation="Cycle" Grid.IsSharedSizeScope="true" 
                                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                                KeyboardNavigation.TabNavigation="Cycle"/>

                                    <bc:MultiStepSlider x:Name="mss" Orientation="Vertical" DockPanel.Dock="Left" PositionType="ptRelative"
                                                        Grid.Column="0"
                                           Steps="{Binding (uc:ToolbarItemEx.Steps), Mode=OneWay,
                                                    RelativeSource={RelativeSource AncestorType={x:Type Grid}}}"
                                           Value="{Binding Path=SliderValue, 
                                                RelativeSource={RelativeSource FindAncestor, 
                                                AncestorType={x:Type uc:ToolbarItemEx}}, Mode=TwoWay}"
                                           Maximum="{Binding Path=SliderMaximum, 
                                                RelativeSource={RelativeSource FindAncestor, 
                                                AncestorType={x:Type uc:ToolbarItemEx}}, Mode=TwoWay}"
                                           Minimum="{Binding Path=SliderMinimum, 
                                                RelativeSource={RelativeSource FindAncestor, 
                                                AncestorType={x:Type uc:ToolbarItemEx}}, Mode=TwoWay}"                                           
                                           Visibility="{Binding Path=IsSliderEnabled, 
                                                RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type uc:ToolbarItemEx}}, 
                                                Converter={StaticResource btvc}, 
                                                Mode=TwoWay}"        
                                                   
                                                   />


                                </Grid>
                            </ScrollViewer>
                        </bc:DropDown.Content>
                    </bc:DropDown>
                </Grid>
            </bc:HotTrack>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="Header" Value="{x:Null}">
                <Setter TargetName="MenuIcon" Property="Margin" Value="0" />
            </Trigger>
            <Trigger Property="IsHeaderVisible" Value="false">
                <Setter TargetName="MenuIcon" Property="Margin" Value="0" />
            </Trigger>
            <Trigger Property="Command" Value="{x:Null}">
                <Setter TargetName="HeaderButton" Property="IsHitTestVisible" Value="False" />
                <Setter TargetName="ExpanderDropDown" Property="PlacementTarget" Value="{Binding ElementName=templateRoot}" />
                <Setter TargetName="ExpanderHotTrack" Property="BorderThickness"  Value="0" />
            </Trigger>
            <Trigger Property="IsSubmenuOpen" Value="True">
                <Setter TargetName="ExpanderHotTrack" Property="IsSelected" Value="True" />
            </Trigger>
            <Trigger SourceName="ExpanderDropDown" Property="IsMouseOver" Value="True">
                <Setter TargetName="ExpanderHotTrack" Property="IsSelected" Value="True" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="TextElement.Foreground" TargetName="templateRoot" Value="{StaticResource Menu.Disabled.Foreground}"/>
                <Setter Property="Foreground" TargetName="MenuIcon" Value="{StaticResource Menu.Disabled.Foreground}"/>
            </Trigger>
            <Trigger Property="ScrollViewer.CanContentScroll" SourceName="SubMenuScrollViewer" Value="false">
                <Setter Property="Canvas.Top" TargetName="OpaqueRect" Value="{Binding VerticalOffset, ElementName=SubMenuScrollViewer}"/>
                <Setter Property="Canvas.Left" TargetName="OpaqueRect" Value="{Binding HorizontalOffset, ElementName=SubMenuScrollViewer}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>



    <ControlTemplate x:Key="ToolbarEx.SeparatorTemplate" TargetType="{x:Type uc:ToolbarItemEx}">
        <Rectangle Fill="{DynamicResource {x:Static SystemColors.InactiveBorderBrushKey}}" Width="1" VerticalAlignment="Stretch" />
    </ControlTemplate>

    <ControlTemplate x:Key="ToolbarEx.SubSeparatorTemplate" TargetType="{x:Type uc:ToolbarSubItemEx}">        
            <Separator Height="5" HorizontalAlignment="Stretch" />
    </ControlTemplate>

    <ControlTemplate x:Key="ToolbarEx.SubButtonTemplate" TargetType="{x:Type uc:ToolbarSubItemEx}">
        <Border x:Name="templateRoot" BorderBrush="{TemplateBinding BorderBrush}" 
                BorderThickness="{TemplateBinding BorderThickness}" 
                Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
            <bc:HotTrack IsSelected="{TemplateBinding IsHighlighted}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                         HighlightBrush="Transparent" BackgroundBrush="Transparent" >
                <Grid Margin="-1" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition MinWidth="22" SharedSizeGroup="MenuItemIconColumnGroup" Width="Auto"/>
                        <ColumnDefinition Width="13"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="30"/>
                        <ColumnDefinition SharedSizeGroup="MenuItemIGTColumnGroup" Width="Auto"/>
                        <ColumnDefinition Width="20"/>
                    </Grid.ColumnDefinitions>
                    <ContentControl x:Name="Icon" Grid.Column="0" Template="{DynamicResource ToolbarMenuIconTemplate3}"
                                    VerticalAlignment="Center"
                                    Height="16" Width="16" Margin="3" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"  />
                    <!--<ContentPresenter x:Name="Icon" ContentSource="Icon" HorizontalAlignment="Center" 
                                  Height="16" Margin="3" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                  VerticalAlignment="Center" Width="16"/>-->
                    <Border x:Name="GlyphPanel" BorderBrush="{StaticResource MenuItem.Selected.Border}" 
                        BorderThickness="1" Background="{StaticResource MenuItem.Selected.Background}" ClipToBounds="False" HorizontalAlignment="Center" Height="22" Margin="-1,0,0,0" Visibility="Hidden" VerticalAlignment="Center" Width="22">
                        <Path x:Name="Glyph" Data="{StaticResource Checkmark}" 
                          Fill="{StaticResource Menu.Static.Foreground}" FlowDirection="LeftToRight" Height="11" Width="10"/>
                    </Border>
                    <ContentPresenter x:Name="menuHeaderContainer" Grid.Column="2" ContentSource="Header"  
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                  HorizontalAlignment="Left" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" 
                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"  />
                    <TextBlock x:Name="menuGestureText" Grid.Column="4" Margin="{TemplateBinding Padding}" Opacity="0.7" 
                           Text="{TemplateBinding InputGestureText}" VerticalAlignment="Center"/>

                </Grid>
            </bc:HotTrack>
        </Border>
    </ControlTemplate>




    <ItemsPanelTemplate x:Key="ToolbarEx.SliderSupportedPanelTemplate">
        <bc:SliderSupportedPanel x:Name="itemHost" IsItemsHost="True" 
                                             Steps="{Binding (uc:ToolbarItemEx.Steps), 
                                                      Mode=OneWayToSource,
                                                      RelativeSource={RelativeSource AncestorType={x:Type Grid}}}"
                                                      KeyboardNavigation.DirectionalNavigation="Cycle" />
    </ItemsPanelTemplate>
    <ItemsPanelTemplate x:Key="ToolbarEx.HorizontalStackPanelTemplate">
        <StackPanel Orientation="Horizontal" IsItemsHost="True" />
    </ItemsPanelTemplate>


    <ControlTemplate x:Key="ToolbarEx.ComboItemTemplate" TargetType="{x:Type uc:ToolbarSubItemEx}">
        <bc:HotTrack IsSelected="{TemplateBinding IsChecked}" >
            <ContentControl x:Name="MenuIcon" Grid.Column="0" Template="{DynamicResource ToolbarMenuIconTemplate2}" />
        </bc:HotTrack>
    </ControlTemplate>

    <Style x:Key="ToolbarSubItemExStyle" TargetType="{x:Type uc:ToolbarSubItemEx}" BasedOn="{StaticResource {x:Type MenuItem}}">
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template" Value="{DynamicResource ToolbarEx.SubButtonTemplate}"/>
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Style.Triggers>
            <!--<Trigger Property="Role" Value="SubmenuHeader">
                <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, 
                    TypeInTargetAssembly={x:Type MenuItem}}}"/>
            </Trigger>-->
            <Trigger Property="HeaderType" Value="ComboItem">
                <Setter Property="Template" Value="{DynamicResource ToolbarEx.ComboItemTemplate}"/>
            </Trigger>
            <Trigger Property="HeaderType" Value="Separator">
                <Setter Property="Template" Value="{DynamicResource ToolbarEx.SubSeparatorTemplate}" />
            </Trigger>
            <Trigger Property="HeaderType" Value="CheckItem">
                <Setter Property="Template" Value="{DynamicResource ToolbarEx.ComboItemTemplate}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="ToolbarItemExStyle" TargetType="{x:Type uc:ToolbarItemEx}">
        <!--<Setter Property="Padding" Value="6,0" />
        <Setter Property="Margin" Value="3,3,3,0"/>-->        
        <Setter Property="CornerRadius" Value="0"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Foreground" Value="{StaticResource Menu.Static.Foreground}"/>
        <!--<Setter Property="ItemContainerStyle" Value="{StaticResource ToolbarSubItemExStyle}" />-->
        <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
        <Style.Triggers>
            <Trigger Property="HeaderType" Value="Button">
                <Setter Property="Foreground" Value="{DynamicResource Menu.Static.Foreground}"/>
                <Setter Property="Template" Value="{DynamicResource ToolbarEx.ButtonTemplate}"/>
            </Trigger>
            <Trigger Property="HeaderType" Value="Combo">
                <Setter Property="Template" Value="{DynamicResource ToolbarEx.ComboTemplate}"/>
                <Setter Property="ItemsPanel" Value="{DynamicResource ToolbarEx.HorizontalStackPanelTemplate}" />
                <!--<Setter Property="ItemContainerStyle">
                    <Setter.Value>
                        <Style BasedOn="{StaticResource ToolbarSubItemExStyle}" TargetType="{x:Type uc:ToolbarSubItemEx}">
                            <Setter Property="HeaderType" Value="ComboItem" />
                            <Setter Property="IsCheckable" Value="True" />
                        </Style>
                    </Setter.Value>
                </Setter>-->
            </Trigger>
            <Trigger Property="HeaderType" Value="Separator">
                <Setter Property="Template" Value="{DynamicResource ToolbarEx.SeparatorTemplate}" />
            </Trigger>
            <Trigger Property="HeaderType" Value="Check">
                <Setter Property="Template" Value="{StaticResource ToolbarEx.ComboTemplate}"/>
                <Setter Property="ItemsPanel" Value="{StaticResource ToolbarEx.HorizontalStackPanelTemplate}" />
                <!--<Setter Property="ItemContainerStyle">
                    <Setter.Value>
                        <Style BasedOn="{StaticResource ToolbarSubItemExStyle}" TargetType="{x:Type uc:ToolbarSubItemEx}">
                            <Setter Property="HeaderType" Value="CheckItem" />
                            <Setter Property="IsCheckable" Value="True" />
                        </Style>
                    </Setter.Value>
                </Setter>-->
            </Trigger>

            <Trigger Property="HeaderType" Value="MenuButton">
                <!--<Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>-->
                <Setter Property="Template" Value="{StaticResource ToolbarEx.MenuButtonTemplate}"/>
                <Setter Property="ItemsPanel" Value="{StaticResource ToolbarEx.SliderSupportedPanelTemplate}" />
            </Trigger>

            <Trigger Property="IsHeaderAlignRight" Value="True">
                <Setter Property="DockPanel.Dock" Value="Right" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type uc:ToolbarEx}">
        <Style.Resources>
            <Style TargetType="{x:Type uc:ToolbarItemEx}" BasedOn="{StaticResource ToolbarItemExStyle}"  />
            <Style TargetType="{x:Type uc:ToolbarSubItemEx}" BasedOn="{StaticResource ToolbarSubItemExStyle}"  />
        </Style.Resources>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type uc:ToolbarEx}">
                    <ItemsPresenter />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <!--<Setter Property="ItemContainerStyle" Value="{StaticResource ToolbarItemExStyle}" />-->
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <DockPanel LastChildFill="False" IsItemsHost="True" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>





</ResourceDictionary>